<?php
/**注意此文档为UTF-8的编码.
 * Created on 2010-5-29
 *
 * @author EXT <isrn@qq.com>
 *
 */
include ('../../includes/global.php');
include ('../global.php');
include ("../power.php");
$dbcfg=Sys::Gp(array('dbcfg','sevenel'));

switch($_GET['op']){
	case 'grid_data':{
 		$temp=Dgd(array(
		  'db'=>'d_sevenel',
		  'cd'=>'1',
		  'tn'=>"datamod"
		  ));
		foreach ($temp as $key=>$value){
    	$temp[$key]['id_mirror']=$temp[$key]['id'];
    	}
		echo json_encode($temp);
		break;}
	case 'showalltable':{
		$dbinfo=Dgd(array(//SELECT name , sex FROM `_love` WHERE 1 and id < 1 limit 1;
		  'db'=>'d_sevenel',
		  'tn'=>"datamod",
		  'cd'=>"1"
		  ));
		foreach($dbinfo as $db){
			 $nodes[] = array('table'=>$db['id'], 'title'=>$db['name']);
			}
			echo json_encode($nodes);
			break;
		}
 	case 'combo_tree':{
		$node = $_POST['node'];
		$temp=Dgd(array(
		  'db'=>'d_sevenel',
		  'cd'=>"extend_id = '$node'",
		  'tn'=>"datamod"
		  ));
		if($temp!=''){
		foreach ($temp as $key=>$value){
    	$value['leaf'] = $value['leaf']==0?false:true;
    	$cls = $value['leaf']==0?'father':'child';
		$trees[$value['extend_id']][] = array ('id'=>$value['id'], 'text'=>$value['name'],'tabname'=>$value['tabname'], 'leaf'=>$value['leaf'],'cls'=>$cls);
    	}
    	echo json_encode($trees[$node]);
		}
 	break;}
	case 'showtp':{
		Ts('table/database_config.html');
			break;
		}
	case 'showfield':{
		Ts('table/database_config.html');
			break;
		}
	}

?>
